occupy (someone's) mind

Translations
occuper l'esprit de quelqu'un
Definitions
To engage someone's thoughts or attention, often to the extent that they are preoccupied or distracted from other matters.